@extends('admin.layout.layout')
@section('content')   
<div class="row"> 
    <div class="col-lg-12">
        <h1 class="page-header">分类修改</h1>
    </div>
    <!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                分类修改
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-lg-6 col-lg-offset-3">

                       @if (count($errors) > 0)
                        <div class="alert alert-danger">
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                        @endif 
                        
                        <form role="form" action="{{url('/admin/cate/update')}}" method="post">

                            <div class="form-group">
                                            <label>选择分类</label>
                                            <select name="pid" class="form-control">
                                                    <option value="0">顶级分类</option>   
                                                @foreach($cates as $k=>$v)  
                                                    @if($v->id == $cateinfo->pid)
                                                        <option value="{{$v->id}}" selected>{{$v->name}}</option>                                  
                                                    @else
                                                        <option value="{{$v->id}}">{{$v->name}}</option>   
                                                    @endif                               
                                                @endforeach                                   
                                           </select>
                                        </div>
                            <div class="form-group">
                                <label>分类名</label>
                                <input class="form-control" type="text" name="name" value="{{$cateinfo->name}}">
                            </div>   
                            <input type="hidden" name="id" value="{{$cateinfo->id}}">
                            <input type="hidden" name="xpid" value="{{$cateinfo->pid}}">
                            {{csrf_field()}}
                            <button  class="btn btn-primary" type="submit">修改分类</button>                         
                        </form>
                    </div>                                   
                </div>
                <!-- /.row (nested) -->
            </div>
            <!-- /.panel-body -->
        </div>
        <!-- /.panel -->
    </div>
    <!-- /.col-lg-12 -->
</div>
@endsection